﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for Call
/// </summary>
/// 
public enum callTypes { newCall = 0, handoffCall }; // This enum can also be used in any other part of the program 
                                                    // e.g. callTypes c = callTypes.newCall;

public class Call : IComparable { // You need this so that the arraylist can be sorted

    private int callType;
    private int id;

    public int Id {
        get { return id; }
        set { id = value; }
    }

    public int CallType {
        get { return callType; }
        set { callType = value; }
    }

    public int getCallType() {
        return this.callType;
    }

    private int holdTime;

    public int HoldTime {
        get { return holdTime; }
        set { holdTime = value; }
    }
    private int resTime;

    public int ResTime {
        get { return resTime; }
        set { resTime = value; }
    }

    private int enterTime;
    private int exitTime;

    // Default constructer
	public Call() {
        this.callType = (int)callTypes.newCall;
        this.enterTime = 0;
        this.exitTime = 0;
        this.holdTime = 0;
        this.resTime = 0;

	}

    // Normal Constructer
    public Call(int ID, callTypes callType, int enterTime, int exitTime) {
        this.id = ID;
        this.callType = (int)callType;
        this.enterTime = enterTime;
        this.exitTime = exitTime;

    }
    // Accessors/Mutators
    public int getEnterTime() {
        return this.enterTime;
    }

    public void setEnterTime(int time) {
        this.enterTime = time;
    }

    public int getExitTime() {
        return this.exitTime;
    }

    public void setExitTime(int time) {
        this.exitTime = time;
    }

    // Standard toString() function to print out a Call's contents
    public string ToString() {
        return "ID=" +id+ " CallType = " + CallType + " Enter time = " + enterTime + " Exit Time = " + exitTime;

    }

    // This is the comparison method that is used to sort the calls in the arraylist
    public int CompareTo(object obj) {
        Call Compare = (Call)obj;
        int result = this.enterTime.CompareTo(Compare.enterTime);
        if (result == 0)
            result = this.enterTime.CompareTo(Compare.enterTime);
        return result;
    }
    

}
